home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / utils / xad / developer / sources / tools / xadlibinfo.c < prev    next >
C/C++ Source or Header  |  1999-01-01  |  3KB  |  112 lines

  1. #define NAME         "xadLibInfo"
  2. #define DISTRIBUTION "(Freeware) "
  3. #define REVISION     "0"
  4.  
  5. /* Programmheader
  6.  
  7.     Name:        xadLibInfo
  8.     Author:        SDI
  9.     Distribution:    Freeware
  10.     Description:    show informations about xad Clients
  11.     Compileropts:    -
  12.     Linkeropts:    -gsi -l amiga
  13.  
  14.  1.0   18.11.98 : first version
  15. */
  16.  
  17. #include <proto/xadmaster.h>
  18. #include <proto/exec.h>
  19. #include <proto/dos.h>
  20. #include <dos/dosasl.h>
  21. #include "SDI_defines.h"
  22.  
  23. #ifdef __SASC
  24.   #define dosbase     DOSBase 
  25.   #define xadmasterbase     xadMasterBase 
  26.   #define ASSIGN_DOS
  27.   #define ASSIGN_XAD
  28.   #define ASSIGN_SYS     struct ExecBase * SysBase; \
  29.              SysBase = (*((struct ExecBase **) 4));
  30. #else
  31.   struct DosLibrary *     DOSBase = 0;
  32.   struct ExecBase *     SysBase  = 0;
  33.   struct xadMasterBase * xadMasterBase = 0;
  34.  
  35.   #define ASSIGN_DOS     DOSBase = dosbase;
  36.   #define ASSIGN_XAD     xadMasterBase = xadmasterbase;
  37.   #define ASSIGN_SYS     SysBase = (*((struct ExecBase **) 4));
  38. #endif
  39.  
  40. ULONG start(void)
  41. {
  42.   ULONG ret = RETURN_FAIL;
  43.   struct DosLibrary *dosbase;
  44.  
  45.   ASSIGN_SYS
  46.   { /* test for WB and reply startup-message */
  47.     struct Process *task;
  48.     if(!(task = (struct Process *) FindTask(0))->pr_CLI)
  49.     {
  50.       WaitPort(&task->pr_MsgPort);
  51.       Forbid();
  52.       ReplyMsg(GetMsg(&task->pr_MsgPort));
  53.       return RETURN_FAIL;
  54.     }
  55.   }
  56.  
  57.   if((dosbase = (struct DosLibrary *) OpenLibrary("dos.library", 37)))
  58.   {
  59.     struct xadMasterBase *xadmasterbase;
  60.     ASSIGN_DOS
  61.     if((xadmasterbase = (struct xadMasterBase *) 
  62.     OpenLibrary("xadmaster.library", 1)))
  63.     {
  64.       ULONG fl;
  65.       struct xadClient *xc;
  66.  
  67.       ASSIGN_XAD
  68.       ret = 0;
  69.       if((xc = xadGetClientInfo()))
  70.         Printf("\033[4mClients of xadmaster.library %ld.%ld\033[0m\n\n"
  71.     "Name                                    |  ID  | MV |  VER  | Flags\n"
  72.     "----------------------------------------+------+----+-------+---------------\n",
  73.     xadmasterbase->xmb_LibNode.lib_Version,
  74.     xadmasterbase->xmb_LibNode.lib_Revision);
  75.       
  76.       while(xc && !CTRL_C)
  77.       {
  78.         fl = xc->xc_Flags;
  79.  
  80.         Printf("%-40s| ", xc->xc_ArchiverName);
  81.         Printf(xc->xc_Identifier ? "%04ld" : "----", xc->xc_Identifier);
  82.         Printf(" | %2ld |%3ld.%ld%s| ", xc->xc_MasterVersion,
  83.         xc->xc_ClientVersion, xc->xc_ClientRevision, xc->xc_ClientRevision
  84.         >= 100 ? "" : xc->xc_ClientRevision >= 10 ? " " : "  ");
  85.         if(fl & XADCF_FILEARCHIVER)
  86.         {
  87.           fl &= ~XADCF_FILEARCHIVER;
  88.           Printf("FILEARCHIVER%s", fl ? "," : "");
  89.         }
  90.         if(fl & XADCF_DISKARCHIVER)
  91.         {
  92.           fl &= ~XADCF_DISKARCHIVER;
  93.           Printf("DISKARCHIVER%s", fl ? "," : "");
  94.         }
  95.         if(fl & XADCF_EXTERN)
  96.           Printf("EXTERN");
  97.         
  98.         Printf("\n");
  99.     xc = xc->xc_Next;
  100.       }
  101.       if(CTRL_C)
  102.         PrintFault(ERROR_BREAK,0 );
  103.  
  104.       CloseLibrary((struct Library *) xadmasterbase);
  105.     }
  106.     else
  107.       Printf("Could not open xadmaster.library\n");
  108.     CloseLibrary((struct Library *) dosbase);
  109.   }
  110.   return ret;
  111. }
  112.